function createUserList() {
    return [
        {
            userId: 1,
            avatar:
                'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            name: 'admin',
            password: '123456',
            desc: '平台管理员',
            roles: ['平台管理员'],
            buttons: ['cuser.detail'],
            routes: ['home'],
            token: 'Admin Token',
        },
        {
            userId: 2,
            avatar:
                'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            name: 'system',
            password: '123456',
            desc: '系统管理员',
            roles: ['系统管理员'],
            buttons: ['cuser.detail', 'cuser.user'],
            routes: ['home'],
            token: 'System Token',
        },
    ]
}

export default [
    {
        url: '/api/admin/acl/index/login',
        method: 'post',
        response: ({ body }) => {
            const { username, password } = body
            const checkUser = createUserList()
                .find(item => item.name === username && item.password === password)
            if (!checkUser) {
                return { code: 201, ok: false, message: '账号或者密码不正确!-mock' }
            }
            return { code: 200, ok: true, data: checkUser.token }
        }
    },
    {
        url: '/api/admin/acl/index/info',
        method: 'get',
        response: (request) => {
            const token = request.headers.token
            const checkUser = createUserList()
                .find(item => item.token === token)
            if (!checkUser) {
                return { code: 201, ok: false, message: '获取用户信息失败-mock' }
            }
            return { code: 200, ok: true, data: checkUser }
        }
    },
    {
        url: '/api/admin/acl/index/logout',
        method: 'post',
        response: () => {
            return { code: 200, ok: true, data: null }
        }
    },

]